home *** CD-ROM | disk | FTP | other *** search
/ ftp.mactech.com 2010 / ftp.mactech.com.tar / ftp.mactech.com / machack / Hacks97 / WarriorsProgress.sit / Warrior’s Progress / source code / Source / Libraries / Context / Context.h < prev    next >
Text File  |  1997-06-28  |  840b  |  55 lines

  1. // Context.h
  2.  
  3. #ifndef Context_h
  4. #define Context_h
  5.  
  6. #ifndef Integers_h
  7. #include "Integers.h"
  8. #endif
  9.  
  10. class Context
  11.   {
  12.     friend class ContextUser;
  13.     
  14.     private:
  15.         Context *const parent;
  16.         uint32 users;
  17.         bool active;
  18.         
  19.         static Context *current;
  20.     
  21.         void Activate();
  22.         void Deactivate();
  23.         
  24.         void ReenterWithParents();
  25.         
  26.         // not implemented:
  27.             Context( const Context& );
  28.             void operator=( const Context& );
  29.         
  30.     protected:
  31.         virtual void Enter() = 0;
  32.         virtual void Leave() = 0;
  33.         virtual void Check() = 0;
  34.         virtual void Reenter()        { Enter(); }
  35.         
  36.     public:
  37.         Context();
  38.         ~Context();
  39.         
  40.         void BeCurrent();
  41.         void BeActive();
  42.         void BeInactive();
  43.         
  44.         static void LeaveAll();
  45.         
  46.         static void CheckActive();
  47.         static void ReenterActive();
  48.         
  49.         static void Set( Context * );
  50.         
  51.         static Context *Current()    { return current; }
  52.   };
  53.  
  54. #endif
  55.